package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._05工厂方法模式._3计算器扩展;

/**
 * @ClassName FactoryBasic
 * @Description TODO
 * @Author zero
 * @DATE 2023/7/18 8:46 AM
 * @Version 1.0
 */
public class FactoryBasic implements IFactory {
    @Override
    public Operation createOperation(String operType) {
        Operation oper = null;
        switch (operType) {
            case "+":
                oper = new Add();
                break;
            case "-":
                oper = new Sub();
                break;
            case "*":
                oper = new Mul();
                break;
            case "/":
                oper = new Div();
                break;
        }

        return oper;
    }
}
